package components.dialogs.brush
{
	import UIFree.uif_component;
	
	import UIUtils.uif_color;
	import UIUtils.uif_util;
	
	import classes.c_blendMode;
	
	import components.brush.c_baseBrush;
	import components.brush.c_spotBrush;
	import components.dialogs.c_propertyDialog;
	
	import flash.display.BlendMode;
	import flash.events.Event;
	
	public class c_brushParams extends c_baseBrushParams {
		public function c_brushParams(parent: uif_component, a_brush: c_spotBrush, a_title: String='') {
			super(parent, a_brush, a_title);
		}
		
		override protected function propertyList(a_brush: c_baseBrush):Array {
			return [
				{
					title	: 'Радиус',
					type	: c_propertyDialog.PTYPE_NUMBER,
					value	: (a_brush as c_spotBrush).radius - 1
				},{
					title	: 'Режим наложения',
					type	: c_propertyDialog.PTYPE_COMBO,
					value	: uif_util.indexOf(c_blendMode.list, a_brush.blendMode, 'value'),
					items	: c_blendMode.list
				},{
					title	: 'Цвет',
					type	: c_propertyDialog.PTYPE_COLORPICKER,
					value	: a_brush.color
				},{
					title	: 'Прозрачность',
					type	: c_propertyDialog.PTYPE_NUMBER,
					value	: a_brush.colorTransform?(a_brush.colorTransform.alphaMultiplier * 100):1
				},{
					title	: 'Размытие',
					type	: c_propertyDialog.PTYPE_NUMBER,
					value	: a_brush.blur
				}
			]
		}		
		
		override protected function doChange(e: Event): void {
			(brush as c_spotBrush).radius = values[0].value + 1;
			brush.blendMode = values[1].value.value;
			brush.color = values[2].value;
			brush.colorTransform.alphaMultiplier = values[3].value / 100;
			brush.blur = values[4].value;
		}
		
		override protected function doApply(): void {
		}
		
		override protected function doCancel(): void {
		}
		

	}
}